
using Infrastructure.Extensions;
using ZR.Model.Enums;

namespace ZR.Model.BaseFrame.Entity
{
    /// <summary>
    /// 模块
    /// </summary>
    [SugarTable("base_Module")]
    public class ModuleEntity:ModuleEntityBase
    {
        [SugarColumn(IsIgnore = true)]
        public List<ModuleEntity> Children { get; set; }

        [SugarColumn(IsIgnore = true)]
        public MenuTypeEnum? MenuType
        {
            get
            {
                MenuTypeEnum menuType;
                var isOk = Enum.TryParse<MenuTypeEnum>(this.MenuTypeCode, true, out menuType);
                isOk = isOk && Enum.IsDefined<MenuTypeEnum>(menuType);
                if(!isOk)
                {
                    return null;
                }
                return menuType;
            }
        }
    }

}